package com.sjt.mylibrary.utils.net;

import com.lzy.okgo.model.Response;

public class DialogCallback<T> extends JsonCallback<T> {
    @Override
    public void onSuccess(Response<T> response) {

    }

    /*private BaseActivity activity;

    public DialogCallback(BaseActivity activity) {
        this.activity = activity;
    }


    @Override
    public void onStart(Request<T, ? extends Request> request) {
        if (activity != null) activity.showProgress("");
    }

    @Override
    public void onFinish() {
        if (activity == null) return;
        activity.disDialog();
    }

    @Override
    public void onSuccess(Response<T> response) {

    }

    @Override
    public void onError(Response<T> response) {
        Throwable exception = response.getException();
        if(exception !=null)exception.printStackTrace();

        if(exception instanceof UnknownHostException || exception instanceof ConnectException){
            Log.e("OkGo","网络连接失败,请查看网络设置");
            activity.showToast("---");
        }else if(exception instanceof SocketTimeoutException){
            Log.e("OkGo","网络请求超时");

        }else if(exception instanceof HttpException){
            Log.e("OkGo","服务响应失败，404，或者 500");

        }else if(exception instanceof StorageException){
            Log.e("OkGo","sd卡权限异常");

        }else if(exception instanceof IllegalStateException){
            //自己抛的异常，token超时，或者其他类型
//            if(exception.getMessage().startsWith("40001"))activity.goActivity(ActivityLogin.class);
            activity.showToast(exception.getMessage());
        }

    }*/
}
